package main.diamond;

import main.InputHelper;

/**
 * Created by arianne on 2014-07-13.
 */
public class Diamond2 {
    public static void main(String[] args) {
        InputHelper ih = new InputHelper();
        Integer n = null;
        while (n == null) {
            n = ih.getUserInput("Number of *: ");
        }

        printDiamond(n);
    }

    static void printDiamond(int n) {
        printDiamondTop(n);
        printDiamondBottom(n);
    }

    static void printDiamondTop(int n) {
        for (int i=0; i<n; i++) {
            printOneLine(i*2+1, n-i);
            System.out.println();
        }
    }

    static void printDiamondBottom(int n) {
        for (int i=n-2; i>=0; i--) {
            printOneLine(i*2+1,n-i);
            System.out.println();
        }
    }

    static void printOneLine(int numInLine, int numSpaces) {
        for (int j=0; j<numSpaces; j++) {
            System.out.print(" ");
        }
        for (int j=0; j<numInLine; j++) {
            System.out.print("*");
        }
    }
}
